import React, { useEffect, useState } from 'react'
import { getInfo } from "../../service/mineService"
import  {useNavigate} from "react-router-dom"
import {
  Form,
  Input,
  Button,
  Dialog,
  Radio,
  Space,
  Avatar
} from 'antd-mobile'
export default function Info() {
  let navigate  = useNavigate();

  const [userInfo, setuserInfo] = useState<any>({});
  useEffect(() => {
    getInfo().then(res => {
      setuserInfo(res.data.user);
    })
  }, [])

  return (
    <div>
      <div>头像  <Avatar src={"/api2/"+userInfo.avatar} /></div>
      <div>姓名 {userInfo.userName}</div>
      <div>电话 {userInfo.phonenumber}</div>
      <div>余额 {userInfo.balance}</div>
      <Button onClick={() => {
         navigate("/mine/edit");
      }}>修改用户信息</Button>
    </div>
  )
}
